home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- # Sub-tests that require a mounted partition.
- set -e
- partition=$1
-
- . /usr/share/os-prober/common.sh
-
- tmpmnt=/var/lib/os-prober/mount
- if [ ! -d $tmpmnt ]; then
- mkdir $tmpmnt
- fi
-
- for type in $(grep -v nodev /proc/filesystems); do
- # hfsplus filesystems are mountable as hfs. Try hfs last so that we
- # can tell the difference.
- if [ "$type" = hfs ]; then
- delaytypes="${delaytypes:+$delaytypes }$type"
- elif [ "$type" = fuseblk ]; then
- if type ntfs-3g >/dev/null 2>&1; then
- types="${types:+$types }ntfs-3g"
- fi
- else
- types="${types:+$types }$type"
- fi
- done
-
- for type in $types $delaytypes; do
- if mount -o ro -t $type $partition $tmpmnt 2>/dev/null; then
- debug "mounted as $type filesystem"
- for test in /usr/lib/os-probes/mounted/*; do
- debug "running subtest $test"
- if [ -f $test ] && [ -x $test ]; then
- if $test $partition $tmpmnt $type; then
- debug "os found by subtest $test"
- repeat_umount $tmpmnt
- rmdir $tmpmnt || true
- exit 0
- fi
- fi
- done
- repeat_umount $tmpmnt
- break
- fi
- done
-
- rmdir $tmpmnt || true
-
- # No tests found anything.
- exit 1
-